<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>layuiTable</title>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all" />
    <script type="text/javascript" src="../layui/layui.all.js"></script>
    <script type="text/javascript" src="../layui/lay/modules/jquery.js"></script>

</head>
<body>

    <div>

        <table id="demo" lay-filter="test"></table>

    </div>

<script type="text/javascript">
    ///user/tableList


            debugger
            var table = layui.table;
            var colss=[ //表头
                {type:"checkbox",unresize:true,align:"center"},
                {field: 'id', title: 'ID', unresize:true,align:"center"},
                {field: 'name', title: '用户名',unresize:true,align:"center"},
                {field: 'password', title: '性别',unresize:true,align:"center"},
                {field: 'salt', title: '城市',unresize:true,align:"center"}
            ]
            //第一个实例
            table.render({
                elem: '#demo'
                ,height: 312
                ,url: '/user/tableList' //数据接口
                ,page: true //开启分页
                ,method:"get"
                ,cols: [colss]
            });

            table.on('checkbox(test)', function(obj){
                console.log(obj.checked); //当前是否选中状态
                console.log(obj.data); //选中行的相关数据
                console.log(obj.type); //如果触发的是全选，则为：all，如果触发的是单选，则为：one
            });




</script>

</body>
</html>